package edu.bath.sensorframework.sensors;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class VirtualTime {
	private long timeOffset;
	private SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");

	public VirtualTime(String startTime) throws ParseException {
		Date start = sdf.parse(startTime);
		long desiredStartTime = start.getTime();
		long actualStartTime = System.currentTimeMillis();
		this.timeOffset = desiredStartTime-actualStartTime;
	}
	
	public long virtualTimeMillis() {
		return System.currentTimeMillis()+timeOffset;
	}
}
